from StartGroup.models import Group
from ideas.models import Ideas
from django import forms
from django.conf import settings
from django import forms
import datetime
from django.forms.extras.widgets import SelectDateWidget
from datetime import date
from utils.widgets import DatePicker

attrs_dict = { 'class': 'required' }

class IdeaForm(forms.Form):
    
    title = forms.CharField(max_length=50, required=True, label='TITLE', error_messages={'required': 'Please enter Title'},
                                widget=forms.TextInput(attrs={'size':'50', 'id':'id_title'}))
    description = forms.CharField(max_length=200, required=False, label='DESCRIPTION',
                                 widget=forms.Textarea(attrs={'size':'200', 'cols':'100', 'rows':'3', 'id':'id_descritption'}))
    created_date = datetime.date.today()
    
    def save(self, user_id, group_info):
        new_idea = Ideas(group = group_info,
                                title=self.cleaned_data['title'],
                                description=self.cleaned_data['description'],
                                post_by = user_id,
                                )
        new_idea.save()
        return new_idea